
var severUrl = 'http://47.89.20.150/czlycms/'; //服务器ip地址

var titleIndex = $('title').attr('data-ind'); //获取title 的attr 属性

var titleUrl    = {};  // 用于存放url 内的参数  act=index&op=special&special_id=2



var PhotosNavArray = [];  //相册对象存储
var PhotosObj = null;  //相册对象存储


// load header



$(document).click(function(e){ 
	 e = window.event || e; // 兼容IE7
	 obj = $(e.srcElement || e.target);

	    if ($(obj).is("#NavContent") || $(obj).is(".indNav .but i") || $(obj).is("#NavContent *")) { 
	     console.log('内部区域'); 
	   } else {
	    console.log('你的点击不在目标区域');
	    $('#NavContent').hide();

	 } 
});




function loadHeader(){
	var header  = $('#indHead');
	header.load('header/header.html');
}

loadHeader();

function loadFooter(){
	var footer = $('#footerCon');
	footer.load('footer/footer.html');
}

loadFooter()



function setConsoleLog(data) {
 	// body...
 	// console.log(data);
 } 



function zhuanjson() {
	var ObjVal = window.location.href.split('#')[0].substring(window.location.href.split('#')[0].indexOf('?')+1).split("&");
	for(var i=0;i<ObjVal.length;i++){titleUrl[ObjVal[i].substr(0,ObjVal[i].indexOf('='))]=decodeURI(ObjVal[i].substring(ObjVal[i].indexOf('=')+1))};
}
zhuanjson();






// PhotoPreview

function PhotoPreviewFun(data,ind) {

	var PhotoPreview = $('#PhotoPreview');
	var html = '';
	for (var i = 0; i < data.length; i++) {
		html += '<div class="swiper-slide"><div class="tb"><div class="td"><img src="'+data[i]+'"></div></div></div>';
	}
	PhotoPreview.find('.swiper-wrapper').html(html);
	PhotoPreview.show();

	var PhotoPreviewSw = new Swiper ('#PhotoPreviewSw', {
	    pagination: '#pageindphontos',
		paginationType: 'fraction',
		lazyLoading : true,
	    lazyLoadingInPrevNext : true,
		zoom : true,
    })
    PhotoPreviewSw.slideTo(ind, 0)

    PhotoPreview.on('click', '.txit span', function(event) {
    	PhotoPreview.hide();
    	
    	PhotoPreviewSw.destroy();
    });   
}


// PhotoPreview end







 // 替换josn数据里的字符

function expandEntities(data) {
	var string = null;

	if (data && data.length != 0) {
		 string = data.replace(/\&lt;/g,"<").replace(/\&gt;/g,">").replace(/\&amp;/g,"&").replace(/\&nbsp;/g,' ').replace(/\&quot;/g,'"');
	}
    return string;
}
// 替换josn数据里的字符 end




//时间戳 转换方法
	Date.prototype.Format = function(fmt)   
	{ //author: meizz   
	  var o = {   
	    "M+" : this.getMonth()+1,                 //月份   
	    "d+" : this.getDate(),                    //日   
	    "h+" : this.getHours(),                   //小时   
	    "m+" : this.getMinutes(),                 //分   
	    "s+" : this.getSeconds(),                 //秒   
	    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
	    "S"  : this.getMilliseconds()             //毫秒   
	  };   
	  if(/(y+)/.test(fmt))   
	    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
	  for(var k in o)   
	    if(new RegExp("("+ k +")").test(fmt))   
	  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
	  return fmt;   
	}  


	//时间戳 转换方法 end

	//判断 当前 日期是否和上一日期相同
	function ifTimeTrue(topTime,thisTime,nian,yue,ri,lang){
		if (topTime == thisTime) {
			return '';
		}else{
			return '<a href="'+ '#'+lang +'"><span class="nian">'+nian+'</span><span class="yue">'+yue+'</span></a>';
		}
	}
	//判断 当前 日期是否和上一日期相同 end



	// footer wechat 微信

	function wechatFun() {
		$('#footerCon').on('click', '#wechat', function(event) {
			$('#wechatQRCode').show();
			$('#wechatQRCode').click(function(event) {
				$('#wechatQRCode').hide();
			});
		});
	}
	wechatFun();



function guanbiSearchFun(){
	console.log('guanbiSearchFun');

	var ind = $('#searchFormInput').val();

	console.log(ind.length);
	if (ind.length <= 0) {

	}else{
		window.location.href = 'search.html?searchName='+ind;
	}


}